package test.Enum;

import com.alibaba.fastjson.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class TEST {

  public static void main(String[] args) throws IOException {
//    String path = "C:\\Users\\HIC0359\\Desktop\\sfgjyym.txt";
//    readFile(new File(path));


    Set<String> string = new HashSet<>();
    string.add(null);
    if (string.contains(null)) {
      System.out.println("111");
    }
  }

  public static void readFile(File file) throws IOException {
    InputStreamReader reader = new InputStreamReader(new FileInputStream(file));
    BufferedReader br = new BufferedReader(reader);
    String line = "";
    Map map = new HashMap();

    long startTime = System.currentTimeMillis();
    line = br.readLine();
    while (line != null) {
      line = br.readLine(); // 一次读入一行数据
      if (line != null) {
        map.put(line.split("\t")[0], line.split("\t")[1]);
        System.out.println(line.split("\t")[0] + "," + line.split("\t")[1]);
      }
    }
    System.out.println(JSONObject.toJSONString(map));
    long endTime = System.currentTimeMillis();
    System.out.println(endTime - startTime);

    List<Map> list = new LinkedList<>();
    map.keySet().forEach(k -> {
      Map map1 = new HashMap();
      map1.put("code", k);
      map1.put("description", map.get(k));
      list.add(map1);
    });
    System.out.println(JSONObject.toJSONString(list));

  }
}
